package com.yu.dv.entity.res;

import lombok.Data;

import java.util.Map;

@Data
public class SqlGenerationResponse {
    private boolean success;
    private String sql;
    private Map<String, Object> data;
    private String message;
    private Long executionTime;

    // 无参构造器
    public SqlGenerationResponse() {}

    // 基础构造器
    public SqlGenerationResponse(boolean success, String sql, String message) {
        this.success = success;
        this.sql = sql;
        this.message = message;
    }

    // 完整构造器
    public SqlGenerationResponse(boolean success, String sql, String message, Map<String, Object> data) {
        this.success = success;
        this.sql = sql;
        this.message = message;
        this.data = data;
    }

    // 静态工厂方法 - 成功
    public static SqlGenerationResponse success(String sql, String message, Map<String, Object> data) {
        SqlGenerationResponse response = new SqlGenerationResponse(true, sql, message, data);
        return response;
    }

    public static SqlGenerationResponse success(String sql, String message) {
        return success(sql, message, null);
    }

    // 静态工厂方法 - 失败
    public static SqlGenerationResponse error(String sql, String message) {
        return new SqlGenerationResponse(false, sql, message);
    }

    public static SqlGenerationResponse error(String message) {
        return new SqlGenerationResponse(false, null, message);
    }
}